package com.learn.singleton;

/**
 * <p>项目名称: design-pattern </p>
 *
 * <p>文件名称: Singleton </p>
 *
 * Singleton class. Eagerly initialized static instance guarantees thread safety.
 */
public final class Singleton {

    /**
     * Private constructor so nobody can instantiate the class.
     */
    private Singleton(){

    }

    /**
     * Static to class instance of the class.
     */
    private static final Singleton INSTANCE = new Singleton();

    /**
     * To be called by user to obtain instance of the class.
     *
     * @return instance of the singleton.
     */
    public static Singleton getInstance(){
        return INSTANCE;
    }
}
